<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>修改背景</title>
	<!-- <link rel="stylesheet" href="{$CSS}/bootstrap3.3.7.min.css"> -->
	<link rel="stylesheet" href="/layui/css/layui.css">
	<link rel="stylesheet" href="/hyqcss/public.css">
	<style type="text/css">
		
		html{
			height: 100%;
		}
		body{
			height: 100%;
		}
		.friendPublish_container{
			height: 100%;
		}
		.friendPublish_content{
			margin: 20px;
			padding: 20px;
			background: #fff;
		}
		.friendPublish_submitButton_container{
			display: flex;
		}
		.friendPublish_submitButton_container button{
			outline: none;
			width: 120px;
			-webkit-appearance: none;
			background: #1e9fff;
			border: none;
			font-size: 14px;
			color: #fff;
			border-radius: 5px;
			padding: 10px;
		}
		.upLoadImg_container{
			display: flex;
			align-items: center;
		}
		.upLoadImg{
			width: 88px;
			height: 88px;
			margin: 10px 5px;
		}
	</style>
</head>
<body style="background: #e9e9e9;">
	<!-- 顶部提示框 开始 -->
		<div class="public_tipSetting_contaienr">
			<div class="public_tipSetting_content">
				<p>发布个人朋友圈 即可发布到单个员工的（历史）朋友圈，发布企业朋友圈即可发布到多个（或全部）员工的（历史）朋友圈</p>
				<a href="https://support.qq.com/products/174823/faqs/81275" target="_blank">查看教程</a>
				<svg id="closeTips" t="1599462804099" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8813" width="15" height="15"><path d="M512 102.4a409.6 409.6 0 1 0 409.6 409.6 409.6 409.6 0 0 0-409.6-409.6z m181.248 518.144a51.2 51.2 0 0 1-72.704 72.704L512 584.192l-108.544 109.056a51.2 51.2 0 0 1-72.704-72.704L439.808 512 330.752 403.456a51.2 51.2 0 0 1 72.704-72.704L512 439.808l108.544-109.056a51.2 51.2 0 0 1 72.704 72.704L584.192 512z" fill="" p-id="8814"></path></svg>
			</div>
		</div>
	<ul class="public-header-nav">
	    <li><a href="pyq.html">朋友圈</a></li>
	    <li><a class="public-header-nav-active" href="set.html">设置默认个人信息</a></li>
	    <li><a href="pyq_list.html">发布个人朋友圈</a></li>
	    <li><a href="qy_list.html">发布企业朋友圈</a></li>
	</ul>

	<div class="friendPublish_container">
		<div class="friendPublish_content">
			上传背景图： 
			<div class="upLoadImg_container">
				<div class="public_formOther_container">
					<div class="layui-input-block" style="margin-left:0px;">
						<br>
						<img {if !$userBackground->background}onerror="this.style.display='none'" {/if} id="pic_miniprogram_pic" src="{$userBackground->background}"  style="width: 100px; height: 100px;">
						<input type="hidden" name="miniprogram_pic" id="miniprogram_pic" />
						<button type="button" class="layui-btn select_img" data-target="miniprogram_pic">
						  <i class="layui-icon">&#xe67c;</i>上传图片
						</button>
					</div>
				</div>
			</div>
			<br>
			<div class="friendPublish_submitButton_container">
				<button onclick="publish_video()">保存</button>
			</div>
		</div>
	</div>
</body>
</html>
<script src="/cdn/jquery.js"></script>
<script src="/layui/layui.all.js"></script>
<script src="/js/ajax.js"></script>
<script type="text/javascript">
	$("#closeTips").click(function(){
		$('.public_tipSetting_contaienr').hide();
	})
</script>
	<script>
		function publish_video(){
			var img = $('#pic_miniprogram_pic').attr("src");
			if(!img){
				tusi("请选择背景图片");
				return false;
			}
			myAjaxPost(false, true, '', { background:img}, function (resp) {
				if (resp.status == 'success'){
					layer.msg(resp.msg);
				}else{
					layer.msg(resp.msg);
				}
			});
		}
	</script>
	<script>
	$('.select_img').on('click',function  () {
	  	var targetId=this.getAttribute('data-target');
	  	layer.open({
			title:'图片库',
			type: 2,
			area: ['700px', '450px'],
			fixed: false, //不固定
			maxmin: false,
			content: '/imgLib/lib.html?type=vshop_img&target='+targetId
	  	});
	})

	window.uploadImgCallback=function (tgt,url) {
	  console.log('选择图片结果',tgt,url);
	  if(tgt=='image'){
		var inputEle=$('#image');
		var prevEle=$('#pic_image');
		inputEle.val(url);
		prevEle.attr('src',url);
		prevEle.show();
	  }else if(tgt=='link_pic'){
		var inputEle=$('#link_pic');
		var prevEle=$('#pic_link_pic');
		inputEle.val(url);
		prevEle.attr('src',url);
		prevEle.show();
	  }else if(tgt=='miniprogram_pic'){
		var inputEle=$('#miniprogram_pic');
		var prevEle=$('#pic_miniprogram_pic');
		inputEle.val(url);
		prevEle.attr('src',url);
		prevEle.show();
	  }
	};
	</script>